package com.example.library.service;

import com.example.library.bean.model.BookType;
import com.example.library.bean.response.Response;
import com.example.library.bean.response.SuccessResponse;
import com.example.library.dao.BookTypeRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class BookTypeService {

    @Autowired
    private BookTypeRepository bookTypeRepository;

    /**
     * 获取所有的书本类型
     * @return
     */
    public Response getAllBookType() {
        List<BookType> bookTypes = bookTypeRepository.findAll();
        Response response = new SuccessResponse();
        response.setResult(bookTypes);
        return response;
    }

}
